# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=wmat
pkgver=0.1
pkgrel=8
epoch=3
pkgdesc='Automatic tool for testing webmail accounts.'
groups=('blackarch' 'blackarch-cracker' 'blackarch-webapp')
arch=('any')
url='http://netsec.rs/70/tools.html'
license=('custom:unknown')
depends=('python' 'python2-pycurl')
source=('http://security-net.biz/wmat/wmat.zip'
        "$pkgname.py.patch")
sha512sums=('11814dcedd5375aa319d5223a3b03ee3fb9d6eecca4896cc0cfee7b566d9f9c18127348abef2b22d1a99df51e6f358fc82828d5f781b5f0c475ac47efa411750'
            '8c8d679878576c680d03076994a2bebbb41df2a02517a32b695b3338073f805e51da6e6b362c84a5c12f7f64c4785087d8ea3b3ae0a7f1adad150233af4b19c6')

prepare() {
  patch -p1 < wmat.py.patch
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" readme.txt
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm readme.txt LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" <<EOF
#!/bin/sh
exec python2 /usr/share/$pkgname/$pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

